import { createRouter, createWebHistory } from 'vue-router'


const routes = [
  {
    path: '/',
    redirect: '/login' //直接跳转login
  },
  {
    path: '/login',
    name: 'login',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import('../components/login.vue')
  },
  {
    path: '/mainhome',
    name: 'mainhome',
    component: () => import('../components/mainhome.vue'),
    children:[{
      path: '/in1',
      name: 'in1',
      component: () => import('../components/in1.vue')
    },
    {
      path: '/in2',
      name: 'in2',
      component: () => import('../components/in2.vue')
    },
    {
      path: '/object',
      name: 'object',
      component: () => import('../components/object.vue')
    },
    {
      path: '/spend1',
      name: 'spend1',
      component: () => import('../components/spend1.vue')
    },
    {
      path: '/spend2',
      name: 'spend2',
      component: () => import('../components/spend2.vue')
    }]
  }
 
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
